@echo off

set BCKP=backups\backup-%date:~8,2%-%date:~3,2%-%date:~0,2%-exo2+samples\

if exist "%BCKP%" (rd "%BCKP%" /S /Q)

echo =========== Engine ============
xcopy "*.*" 		                ".\%BCKP%"                                      /EXCLUDE:backup.ini /C /Y /Q
xcopy ".\license\*.*" 		        ".\%BCKP%License\"                              /C /Y /Q /E
xcopy ".\resources\*.*" 		    ".\%BCKP%resources\"                            /C /Y /Q /E
xcopy ".\src\*.*" 		            ".\%BCKP%src\"                                  /C /Y /Q /E

echo ============ Tools ============
xcopy ".\tools\*.*"                 ".\%BCKP%tools\"                                /EXCLUDE:backup.ini /C /Y /Q
for /d %%a in (.\tools\*) do xcopy  "%%a\*.*" ".\%BCKP%%%a\"                        /EXCLUDE:backup.ini /C /Y /Q
for /d %%a in (.\tools\*) do xcopy  "%%a\src\*.*" ".\%BCKP%%%a\src\"                /EXCLUDE:backup.ini /C /Y /Q /E
for /d %%a in (.\tools\*) do xcopy  "%%a\resources\*.*" ".\%BCKP%%%a\resources\"    /C /Y /Q /E

echo =========== Samples ===========
xcopy ".\samples\*.*"               ".\%BCKP%samples\"                              /EXCLUDE:backup.ini /C /Y /Q
for /d %%a in (.\samples\*) do xcopy "%%a\*.*" ".\%BCKP%%%a\"                       /EXCLUDE:backup.ini /C /Y /Q
for /d %%a in (.\samples\*) do xcopy "%%a\src\*.*" ".\%BCKP%%%a\src\"               /EXCLUDE:backup.ini /C /Y /Q /E
for /d %%a in (.\samples\*) do xcopy "%%a\resources\*.*" ".\%BCKP%%%a\resources\"   /C /Y /Q /E

pause
